home *** CD-ROM | disk | FTP | other *** search
/ Celestin Apprentice 7 / Apprentice-Release7.iso / Source Code / C / Applications / POV-Ray 3.0.2 / src / MacSource / LnkLst.h < prev    next >
Encoding:
C/C++ Source or Header  |  1996-07-14  |  2.4 KB  |  87 lines  |  [TEXT/CWIE]

  1. /*==============================================================================
  2. Project:    POV
  3.  
  4. Version:    3
  5.  
  6. File:    LnkLst.h
  7.  
  8. Description:
  9. Routines to handle linked lists
  10. ------------------------------------------------------------------------------
  11. Author:
  12.     Eduard [esp] Schwan
  13. ------------------------------------------------------------------------------
  14.     from Persistence of Vision(tm) Ray Tracer
  15.     Copyright 1996 Persistence of Vision Team
  16. ------------------------------------------------------------------------------
  17.     NOTICE: This source code file is provided so that users may experiment
  18.     with enhancements to POV-Ray and to port the software to platforms other 
  19.     than those supported by the POV-Ray Team.  There are strict rules under
  20.     which you are permitted to use this file.  The rules are in the file
  21.     named POVLEGAL.DOC which should be distributed with this file. If 
  22.     POVLEGAL.DOC is not available or for more info please contact the POV-Ray
  23.     Team Coordinator by leaving a message in CompuServe's Graphics Developer's
  24.     Forum.  The latest version of POV-Ray may be found there as well.
  25.  
  26.     This program is based on the popular DKB raytracer version 2.12.
  27.     DKBTrace was originally written by David K. Buck.
  28.     DKBTrace Ver 2.0-2.12 were written by David K. Buck & Aaron A. Collins.
  29. ------------------------------------------------------------------------------
  30. Change History:
  31. ==============================================================================*/
  32.  
  33. #ifndef LNKLST_H
  34. #define LNKLST_H
  35.  
  36. typedef unsigned short LLIndex_t;
  37.  
  38. // An Element struct, holds link refs and ptr to actual data
  39. typedef struct
  40. {
  41.     void*        fNext;
  42.     void*        fPrev;
  43.     void*        fData;
  44. } LLElRec, *LLElPtr, **LLElHdl;
  45.  
  46. // A Header struct, holds info for one linked list
  47. typedef struct
  48. {
  49.     short        fMaxElements;
  50.     short        fNumElements;
  51.     LLElPtr        fFirstElement;
  52.     LLElPtr        fLastElement;
  53. } LLHeadRec, *LLHeadPtr, **LLHeadHdl;
  54.  
  55. // NOTE: Index is 1..n
  56.  
  57. // House keeping
  58.  
  59. LLHeadPtr LLCreateList(short MaxElements);
  60.  
  61. void LLDestroyList(LLHeadPtr LL);
  62.  
  63. void LLDeleteAllElements(LLHeadPtr LL);
  64.  
  65. // Add
  66.  
  67. void LLAddElementByIndex(LLHeadPtr LL, void * DataPtr, short Index);
  68. void LLAppendElement(LLHeadPtr LL, void * DataPtr);
  69.  
  70. // Delete
  71.  
  72. void LLDeleteElementByIndex(LLHeadPtr LL, short Index);
  73.  
  74. // Gets
  75.  
  76. short LLGetMaxElements(LLHeadPtr LL);
  77.  
  78. short LLGetNumElements(LLHeadPtr LL);
  79.  
  80. void * LLGetElementByIndex(LLHeadPtr LL, short Index);
  81.  
  82. #ifdef LLTEST
  83. void LLTest(void);
  84. #endif
  85.  
  86. #endif
  87.